using System;
using System.Collections.Generic;
using System.Text;
using System.IO;

namespace BizTalkCrossReferenceManager.UI.Generation.Generators
{
    /// <summary>
    /// Generates the command file
    /// </summary>
    public class BTSCommandFileGenerator
    {
        private const string FileName = "SetupXRefData.cmd";

        /// <summary>
        /// Generates file
        /// </summary>
        /// <param name="outputFolder"></param>
        /// <param name="btsXRefImportExePath"></param>
        public static void Generate(string outputFolder, string btsXRefImportExePath)
        {
            string path = outputFolder + @"\" + FileName;
            string code = string.Format(Properties.Resources.BTSCommandLine, btsXRefImportExePath, outputFolder, BtsSetupFilesGenerator.FileName);

            using (FileStream fs = new FileStream(path, FileMode.Create, FileAccess.Write))
            {
                using (StreamWriter writer = new StreamWriter(fs))
                {
                    writer.Write(code);
                    writer.Flush();
                }
            }
        }
    }
}
